- add_to_breadcrumbs s_('TagsPage|Tags'), project_tags_path(@project)
- page_title s_('TagsPage|New')
- default_ref = params[:ref] || @project.default_branch

- if @error
  = render Pajamas::AlertComponent.new(variant: :danger, dismissible: true) do |c|
    - c.with_body do
      = @error

%h1.page-title.gl-font-size-h-display
  = s_('TagsPage|New Tag')

%p.gl-text-secondary
  - link_start = '<a href="%{url}">'.html_safe % { url: new_namespace_project_release_path }
  - link_end = '</a>'.html_safe
  = s_('TagsPage|Do you want to create a release with the new tag? You can do that in the %{link_start}New release page%{link_end}.').html_safe % { link_start: link_start, link_end: link_end }

= form_tag namespace_project_tags_path, method: :post, id: "new-tag-form", class: "common-note-form tag-form js-quick-submit js-requires-input" do
  .form-group.row
    .col-sm-12
      = label_tag :tag_name, _('Tag name')
      = text_field_tag :tag_name, params[:tag_name], required: true, autofocus: true, class: 'form-control', data: { qa_selector: "tag_name_field" }
  .form-group.row
    .col-sm-auto.create-from
      = label_tag :ref, _('Create from')
      .js-new-tag-ref-selector{ data: { project_id: @project.id, default_branch_name: default_ref, hidden_input_name: 'ref' } }
      .form-text.text-muted
        = s_('TagsPage|Existing branch name, tag, or commit SHA')
  .form-group.row
    .col-sm-12
      = label_tag :message, _('Message')
      = text_area_tag :message, @message, required: false, class: 'form-control', rows: 5, data: { qa_selector: "tag_message_field" }
      .form-text.text-muted
        = tag_description_help_text

  .gl-display-flex
    = render Pajamas::ButtonComponent.new(variant: :confirm, button_options: { class: 'gl-mr-3', data: { qa_selector: "create_tag_button" }, type: 'submit' }) do
      = s_('TagsPage|Create tag')
    = render Pajamas::ButtonComponent.new(href: project_tags_path(@project)) do
      = s_('TagsPage|Cancel')
